# This is a Python3 script to help me remap some of the Java Identifiers
# (from Forge to Fabric) so that I won't need to do everything manually
rmps = { }

with open('remap.txt', 'r+') as f:
    # Read remapping table
    while True:
        line = f.readline()
        if not line:
            break

        line = line.strip()

        if len(line) <= 0 or line[0] == '#':
            continue

        rmp = line.split(' ', 1)
        rmps[rmp[0].rstrip()] = rmp[1].lstrip()

    print(rmps)

    # Do remapping
    with open('original.txt', 'r+') as fin:
        text = fin.read()
        for k, v in rmps.items():
            text = text.replace(k, v)

        with open('processed.txt', 'w+') as fout:
            fout.write(text)

print('Done.')
